# -*- coding: UTF-8 -*-
'''
@Project ：suanfa 
@File    ：01BinarySearch.py
@IDE     ：PyCharm 
@Author  ：Wu
@Date    ：2023/12/12 16:05 
'''


list = [1,2,6,8,9,11,13,16,17,19,21]


def BSearch(list,num):
    left = 0
    hight = len(list) -1 # 11
    while left <= hight :
        mid_tag = (left + hight) // 2 # 5
        if num == list[mid_tag]:
            return mid_tag
        elif num < list[mid_tag]:
            hight = mid_tag - 1
        else:
            left = mid_tag + 1
    return "没有目标数"


print(BSearch(list,00))

